<template>
	<view>
		<view v-for="(item,idx) in list" style="padding: 10px;">
			<view style="padding: 10px; display: flex;background-color: antiquewhite;">
				<view style="flex: 1;">
					<view>
						username:{{item.username}}
					</view>
					<view>
						UID:{{item.uid}}
					</view>
					<view>
						nickname:{{item.nickname}}
					</view>
				</view>
				<view style="line-height: 100%;display: flex;align-items: center;">
					<button @click="toChat(item,idx)">对话</button>
				</view>
			</view>
			<view style="background-color: aliceblue;height: 2px;"></view>
		</view>
		
	</view>
</template>

<script>
	import {
		// sendToChat,
		// readChat,
		// getChat,
		// list,
		// oneUser,
		unread,
		updateReadState
	} from "@/api/chat"
	export default {
		data() {
			return {
				page:1,
				list:[]
			}
		},
		onLoad(){
			console.log(111)
			this.getUserList()
		},
		methods: {
			toChat(item,idx){
				uni.navigateTo({
					url:"/pages/chat/chat?uid="+item.uid+"&nickname="+item.nickname
				})
			},
			async getUserList(){
				const res = await this.$http.post('/api/user/getList', {page:this.page})
				if(res.code==200){
					this.list=res.data
				}
				
			}
		}
	}
</script>

<style>

</style>
